package com.lzy.system.organization.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.lzy.exception.BusException;
import com.lzy.system.organization.entity.SysRes;
import com.lzy.system.organization.entity.SysResRole;
import com.lzy.system.organization.entity.SysRole;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author lcc
 * @since 2022-08-17
 */
public interface ISysResRoleService extends IService<SysResRole> {
    /**
     * 根据用户查询权限资源
     * @param uid
     * @return
     */
    List<SysRes> queryByUid(String uid) throws BusException;

    /**
     * 根据用户和url查询权限资源
     * @param uid
     * @param url
     * @return
     * @throws BusException
     */
    List<SysRes> queryByUidAndUrl(String uid,String url) throws BusException;

    /**
     * 根据资源id查询角色绑定资源
     * @param resId
     * @return
     */
    List<SysResRole> queryByResId(Long resId) throws BusException;

    /**
     * 根据角色id查询角色绑定资源
     * @param roleId
     * @return
     */
    List<SysResRole> queryByRoleId(Long roleId) throws BusException;

    /**
     * 资源授权 资源
     * @param resId
     * @param sysRoles
     */
    void savePowerByResId(Long resId , List<SysRole> sysRoles) throws BusException;

    /**
     * 资源授权 角色
     * @param roleId
     * @param sysResList
     */
    void savePowerByRoleId(Long roleId , List<SysRes> sysResList) throws BusException;
}
